import { LOGN_SHOW_LOADING, LOGIN_IN } from "../../action-types/loginType";

let initStates = {
  isLoading: false,
  result: {}
};

function login(state = initStates, action) {
  switch (action.type) {
    case LOGN_SHOW_LOADING:
      return {
        ...state,
        isLoading: action.isLoading
      };

    case LOGIN_IN:
      return {
        ...state,
        result: action.result,
        isLoading: action.isLoading
      };
    default:
      return state;
  }
}

export default login;
